<template>
  <div style="width: 100%">
    <div style="width: 1200px;margin: 50px auto;">
      <el-container>
        <el-header class="header">
          <div class="user-title">
            <img width="150" src="../../assets/logo.png" alt="" @click="toSy()">
            <a style="margin-left: 20px">个人中心</a>
          </div>
          <div class="gohome" @click="toSy">回到首页</div>
        </el-header>
        <el-container style="margin-top: 15px">
          <el-aside width="200px" style="height: 600px; background: #ffffff">
            <el-menu
                :default-active="index"
                class="el-menu-vertical-demo"
                @open="handleOpen"
                @close="handleClose"
                unique-opened="unique-opened"
                router>
              <el-submenu index="/myInfo">
                <template slot="title">
                  <span>账户设置</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/myInfo">个人资料</el-menu-item>
                  <el-menu-item index="/userSafety">账户安全</el-menu-item>
                  <el-menu-item index="/myAddress">常用地址</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-submenu index="/myOrder">
                <template slot="title">
                  <span>订单管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/myOrder">我的订单</el-menu-item>
                  <el-menu-item index="/myAfterSale">我的售后</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-menu-item index="/myCart">我的购物车</el-menu-item>
            </el-menu>
          </el-aside>
          <el-main style="margin-left:10px;height: 600px; background: #ffffff">
            <router-view/>
          </el-main>
        </el-container>
      </el-container>
    </div>
    <foot></foot>
  </div>

</template>

<script>
import foot from "@/components/foot.vue"

export default {
  name: "userDetail",
  components: {foot},
  data() {
    return {
      index:""
    }
  },
  methods: {
    toSy() {
      this.$router.push('/');
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  },
  mounted() {
    this.index=this.$route.path;
  }
}
</script>

<style scoped>
.el-menu-item-group{
  background-color: #f8fcfa;
}
.header {
  width: 100%;
  background: #ffffff;
  height: 80px;
  display: flex;
  align-items: center;
  position: relative;
}

.gohome {
  position: absolute;
  right: 30px;
  border-left: #969896;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}

.gohome:hover {
  color: #ff0000;
}

.user-title {
  display: flex;
  width: 400px;
  align-items: center;
}

.user-title img {
  cursor: pointer;
}

a {
  text-decoration: none;
  color: #333;
  cursor: pointer;
  font-size: 20px;
  font-weight: bolder;
}
</style>